package com.spgf.model.dao.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

@SuppressLint("SdCardPath")
public class CustomSQLiteOpenHelper extends SQLiteOpenHelper {

	private static final int		DATABASE_VERSION		= 1;

	protected static final String	DATABASE_NAME			= "economizedb.db";
	protected static final String	DATABASE_NAME_SCRIPT	= "economizedb.sql";

	protected static String			DB_PATH_INTERNO			= "/data/data/com.spgf.controller/databases/";
	protected static String			DB_PATH_EXTERNO			= "/sdcard/Android/";

	Context							context;
	private SQLiteDatabase			dbQuery;

	public CustomSQLiteOpenHelper(final Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		this.context = context;
	}

	@Override
	public synchronized void close() {
		if (dbQuery != null) {
			dbQuery.close();
		}
		super.close();
	}

	@Override
	public void onCreate(final SQLiteDatabase db) {}

	@Override
	public void onUpgrade(final SQLiteDatabase db, final int arg1, final int arg2) {
		onCreate(db);
	}

}
